package com.itheima.myextends.继承下成员变量访问特点_04;

class   Ye{
    String name = "德玛";
    int age = 65;
}

class  Fu extends  Ye{
    String name = "赵信";
    int age = 45;
}


public class Zi extends Fu{
    //成员变量
    int age = 18;

    public void method(){
        int age = 17;
        System.out.println(age);

        System.out.println(this.age);

        System.out.println(super.age);
        /*
            注意: this.在找本类成员找不到时,会渗透到父类成员位置寻找
                  this.找不到本类成员时,效果等同于super!
         */
        Ye ye = new Ye();
        System.out.println(ye.age);
    }

    public void method1(){
        System.out.println(name);
        System.out.println(super.name);
        System.out.println(new Ye().name);
    }
}
